package com.baweiwei.userapi.contoller;

import com.baweiwei.userapi.feign.GoodFeign;
import com.baweiwei.userapi.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.math.BigDecimal;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

@RestController
@RequestMapping("/user")
public class UserController {

    @Autowired
    private UserService userService;

    @RequestMapping("/money")
    public Map<String,Object> money(Integer userId, BigDecimal money){
        Map<String,Object> map = new HashMap<>();
        int i = userService.updateMoney(userId, money);
        if(i<=0){
            map.put("data",false);
            return map;
        }
        map.put("data",true);
        return map;
    }
}
